const Sequelize = require('sequelize');
module.exports = function(sequelize, DataTypes) {
  return sequelize.define('act_cmmn_hi_case_inst', {
    id: {
      type: DataTypes.STRING(255),
      allowNull: false,
      primaryKey: true,
      field: 'ID_'
    },
    rev: {
      type: DataTypes.INTEGER,
      allowNull: false,
      field: 'REV_'
    },
    businessKey: {
      type: DataTypes.STRING(255),
      allowNull: true,
      field: 'BUSINESS_KEY_'
    },
    name: {
      type: DataTypes.STRING(255),
      allowNull: true,
      field: 'NAME_'
    },
    parentId: {
      type: DataTypes.STRING(255),
      allowNull: true,
      field: 'PARENT_ID_'
    },
    caseDefId: {
      type: DataTypes.STRING(255),
      allowNull: true,
      field: 'CASE_DEF_ID_'
    },
    state: {
      type: DataTypes.STRING(255),
      allowNull: true,
      field: 'STATE_'
    },
    startTime: {
      type: DataTypes.DATE(3),
      allowNull: true,
      field: 'START_TIME_'
    },
    endTime: {
      type: DataTypes.DATE(3),
      allowNull: true,
      field: 'END_TIME_'
    },
    startUserId: {
      type: DataTypes.STRING(255),
      allowNull: true,
      field: 'START_USER_ID_'
    },
    callbackId: {
      type: DataTypes.STRING(255),
      allowNull: true,
      field: 'CALLBACK_ID_'
    },
    callbackType: {
      type: DataTypes.STRING(255),
      allowNull: true,
      field: 'CALLBACK_TYPE_'
    },
    tenantId: {
      type: DataTypes.STRING(255),
      allowNull: true,
      defaultValue: "",
      field: 'TENANT_ID_'
    }
  }, {
    sequelize,
    tableName: 'act_cmmn_hi_case_inst',
    timestamps: false,
    indexes: [
      {
        name: "PRIMARY",
        unique: true,
        using: "BTREE",
        fields: [
          { name: "ID_" },
        ]
      },
    ]
  });
};
